<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item>1</van-swipe-item>
      <van-swipe-item>2</van-swipe-item>
      <van-swipe-item>3</van-swipe-item>
      <van-swipe-item>4</van-swipe-item>
    </van-swipe>
    <Address ref="Address" :showValue='value' :title="title" @save='addressVal'></Address>
    <van-field readonly clickable name="datetimePicker" :value="selVal" label="地址选择" placeholder="点击选择地址"
      @click="$refs['Address'].showDialog()" />
  </div>
</template>

<script>
  import Address from '@/views/components/address'

  export default {
    name: 'Demo1',
    components: {
      Address
    },
    metaInfo: {
      title: 'demo1'
    },
    data() {
      return {
        value: '',
        selVal: '',
        title: '选择地址',
      }
    },
    created() {},
    mounted() {},
    destoryed() {},
    methods: {
      showAddress() {
        this.$refs['Address'].show = true
      },
      // 选中的地址
      addressVal(val) {
        console.log(val);
        this.selVal = val.filter((item) => !!item).map((item) => item.name).join('/');
      }
    }
  }

</script>

<style lang="less" scoped>
  .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;
    background-color: #39a9ed;
  }

</style>
